package thread;

import java.util.TreeSet;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-07-23
 * Time: 16:24
 */
public class Demo8 {
    public static boolean isQuit = false;
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
            while (!isQuit) {
                System.out.println("Thread");

                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }

        });
        t.start();
        Thread.sleep(3000);
        isQuit = true;
        System.out.println("t线程终止");
    }
}
